#define _CRT_SECURE_NO_WARNINGS 1

 /*结构体内存对齐*/
//对齐数=默认对齐数与该成员大小的较小值，VS默认对齐数为8
//结构体大小是最大对齐数的整数倍
#include<stdio.h>

struct S
{
	char c1;//1
	int i;   //4
	char c2;//1
};

struct SS
{
	char c1;// 1
	int i;   //4
	double c2;//8
};

struct S4
{
	double c1;
	char i;  
	int c2;
};//16字节


struct S5
{
	char c1;// 1
	struct S4 s;//8
	double c2;//8	
};

int main(void)
{
	struct S s1;
	struct SS s2;
	struct S5 s3;
	printf("%d\n", sizeof(s1));
	printf("%d\n", sizeof(s2));
	printf("%d\n", sizeof(s3));

	return 0;
}

